package com.briup.app01.dao;

import java.util.List;

import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;

import com.briup.app01.bean.Article;

public interface ArticleDao {
	  @Insert("insert into cms_article(id,title,content,publish_time,read_times,status,thump_up,cover,project_id,author_id,category_id,compony_id)"
	     		+ "values(null,#{title},#{content},#{publishTime},#{readTimes},#{status},#{thumpUp},#{cover},#{projectId},#{authorId},#{categoryId},#{componyId})")
		public void save(Article article);
	     
	     @Select("select * from cms_article")
	    List<Article> selectAll();
	    
	     @Select("select * from cms_article where id = #{id}")
	     Article selectById(Long id);
	     
	     @Delete("delete from cms_article where id = #{id}")
	     void delete(Long id);
	     
	     @Update("update cms_article set title = "
	     		+ "#{title},content = #{content},"
	     		+ "publish_time =#{publishTime},read_times=#{readTimes},status=#{status},thump_up=#{thumpUp},cover=#{cover},project_id=#{projectId},author_id=#{authorId},category_id=#{categoryId},compony_id=#{componyId} where id =#{id}")
	     void update(Article article);
}
